package event;

import java.io.Serializable;
import main.EventCallbackFunctionOwner;

public class DEFINES {
	public static final class CEPLEventCallback {
		public CEPLEventCallback(EventCallbackFunctionOwner _functionOwner,
				boolean _active) {
			functionOwner = _functionOwner;
			active = _active;
		}

		public EventCallbackFunctionOwner functionOwner;
		public boolean active;
	}

	public static final class CEPLEventDataFieldDefinition {
		public String fieldName;
		public boolean isNumerical; // yes -> number, no -> char-string
		public boolean isFloatingPoint;

		// yes -> that preceding length in event data is an unsigned short int
		public boolean isPrecededByLengthInBytes;
		public short lengthInBytes;

		// if isPrecededByLengthInBytes == false -> lengthInBytes must be set in
		// this struct
		// if isNumerical == false -> lengthInBytes must be set in this struct
		// lengthInBytes includes the null-character in case of a char-string

		// if isNumerical && isFloatingPoint && lengthInBytes == 4 -> float
		// if isNumerical && isFloatingPoint && lengthInBytes == 8 -> double
		// if isNumerical && !isFloatingPoint && lengthInBytes == 1 -> char
		// if isNumerical && !isFloatingPoint && lengthInBytes == 2 -> short
		// if isNumerical && !isFloatingPoint && lengthInBytes == 4 -> int
		// if isNumerical && !isFloatingPoint && lengthInBytes == 8 -> long
	}

	public static enum CEPLEventDataFieldType {
		UNKNOWN, CHAR, SHORT, INT, LONG, FLOAT, DOUBLE, TEXT
	}

	public static final class CEPLEventDataFieldValue implements Serializable {
		private static final long serialVersionUID = -9116075790884861371L;

		public String fieldName;
		public CEPLEventDataFieldType type;
		public short lengthInBytes;

		// String, Float, Double, Character, Short or Integer
		public Object value;
	}
}
